<?php	/* gmslOpenSource 2008 */
/*
----------------------------------------------------------------------------------------
	Project name:		gmslappcore
	Section:		login
----------------------------------------------------------------------------------------
	Script name:		logout.php
	Script location:	./gmslappcore/pages/
	Script version:		1.0
----------------------------------------------------------------------------------------
	Script info:		This page should be included at the beginning
				of every page in the system. It controls the
				whole of the main system, including databse
				connection.
	Script dependencies:
 				~None.
----------------------------------------------------------------------------------------
	This script is part of the gmslappcore system which is released
	under the GNU licese.
	Copyright: (c) 2008 groupmsl (groupmsl.co.uk)
	Email: projects+gmslappcore@groupmsl.co.uk
	Website: www.groupmsl.co.uk?section=cms&page=view&t=gmslappcore&f=groupmsl Open Source/gmslappcore
----------------------------------------------------------------------------------------
	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------------------
*/
		session_start("$unixid");
		require('../system/connection.php');
		$pgtitle="Logout";
		$pgsubtitle="Logout so that no one can abuse your acount";
		require('../skin/head.php');
		echo "<link href='../system/system.css' rel='stylesheet' type='text/css' />";
		require('../skin/header.php');
// Checks to see if user was logged in. If the user was not logged in:
		if(!$_SESSION["gmslcmsusername"])
			{
			echo
			"<p class=error>You were not logged in anyway!</p>
			<meta http-equiv='Refresh' content='5;url=../index.php' />";
			unset($_SESSION["gmslcms_logged_in"]);
			unset($_SESSION["gmslcms_user_type"]);
			unset($_SESSION["gmslcms_user_fullname"]);
			}
// If user was logged in:
		else
			{
			unset($_SESSION["gmslcmsusername"]);
			unset($_SESSION["gmslcms_logged_in"]);
			unset($_SESSION["gmslcms_user_type"]);
			unset($_SESSION["gmslcms_user_fullname"]);
// Checking to see if login was sucessfull. If it was:
			if(!$_SESSION["gmslcmsusername"])
				{
				echo
				"<p class=normaltext><font class='correct'>You have been logged out!</font> You will be redirected to the homepage in 5 seconds.</p>
				<meta http-equiv='Refresh' content='5;url=../index.php' />";
				}
// If it was not:
			else
				{
				echo
				"<p class=error>There was an error, please try again.</p>
				<meta http-equiv='Refresh' content='5;url=index.php' />";
				}
			}
		require('../skin/footer.php');
?>
